All Questions
4 questions
1vote
1answer
2kviews
How to call sub function of a different function from current function in ksh?
In this is the scenario, need to call func1 from Main_Func. How do I call it? Main_Func() { <code> } Initialize_func() { func1() { <code> } }
4votes
4answers
107views
Is it possible to use functions declared in a shell flavor in another shell type
I have a bash script that contains many common functions definitions for our Linux system. Is it possible to source it and use functions from another shell flavor (csh and ksh) ?
0votes
3answers
3kviews
Get the name of the shell script from inside a function
Say I've got this: #!/bin/sh function show_help { cat<<% Usage: $0 [-h] % } # the following lines is pseudo-code if argument contains "-h" show_help otherwise do_stuff If I run ./test it ...
47votes
4answers
43kviews
Executing user defined function in a find -exec call
I'm on Solaris 10 and I have tested the following with ksh (88), bash (3.00) and zsh (4.2.1). The following code doesn't yield any result: function foo { echo "Hello World" } find somedir -exec ...